package com.ruoyi.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.platform.annotation.Excel;
import com.ruoyi.platform.core.domain.BaseEntity;
import com.ruoyi.platform.utils.BeanUtils;
import com.ruoyi.platform.utils.spring.SpringUtils;
import com.ruoyi.utils.BaseFileUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

/**
 * 轮播图对象 tp_banner
 *
 * @author tp
 * @date 2022-11-01
 */
@ApiModel(value="轮播图对象 tp_banner", description="tp_banner业务表")
@TableName("tp_banner")
public class Banner extends BaseEntity<Banner>
{
private static final long serialVersionUID = 1L;

    /** 主键ID */
    @ApiModelProperty(value = "主键ID")
    @TableId(type = IdType.AUTO)
    private Integer id;

    /** 轮播标题 */
    @Excel(name = "轮播标题")
    @ApiModelProperty(value = "轮播标题")
    private String title;

    /** 轮播图名称 */
    @Excel(name = "轮播图名称")
    @ApiModelProperty(value = "轮播图名称")
    private String name;

    /** 文件ID */
    @Excel(name = "文件ID")
    @ApiModelProperty(value = "文件ID")
    private Long fileId;

    /** 轮播类型 */
    @Excel(name = "轮播类型")
    @ApiModelProperty(value = "轮播类型")
    private Integer type;

    /** 是否展示:0=不展示,1=展示 */
    @Excel(name = "是否展示:0=不展示,1=展示")
    @ApiModelProperty(value = "是否展示:0=不展示,1=展示")
    private Integer isShow;

    /** （0未删除1已删除） */
    @ApiModelProperty(value = "是否展示:0=不展示,1=展示")
    private Integer delFlag;

    @ApiModelProperty(value = "下载地址")
    private String downloadUrl;

    public String getDownloadUrl() {
        return downloadUrl;
    }

    public void setDownloadUrl(String downloadUrl) {
        this.downloadUrl = downloadUrl;
    }

    @ApiModelProperty(value = "上传图片的实际url地址")
    @TableField(exist = false)
    private String realFileUrl;

    public String getRealFileUrl() {
        String realFileUrl = "";
        if (BeanUtils.isNotEmpty(this.fileId)){
            realFileUrl= SpringUtils.getBean(BaseFileUtils.class).getFileUrlById(fileId.toString());
        }
        return realFileUrl;
    }

    public void setRealFileUrl(String realFileUrl) {
        this.realFileUrl = realFileUrl;
    }

    public void setId(Integer id)
            {
            this.id = id;
            }

    public Integer getId()
            {
            return id;
            }
    public void setTitle(String title)
            {
            this.title = title;
            }

    public String getTitle()
            {
            return title;
            }
    public void setName(String name)
            {
            this.name = name;
            }

    public String getName()
            {
            return name;
            }

    public Long getFileId() {
        return fileId;
    }

    public void setFileId(Long fileId) {
        this.fileId = fileId;
    }

    public void setType(Integer type)
            {
            this.type = type;
            }

    public Integer getType()
            {
            return type;
            }
    public void setIsShow(Integer isShow)
            {
            this.isShow = isShow;
            }

    public Integer getIsShow()
            {
            return isShow;
            }
    public void setDelFlag(Integer delFlag)
            {
            this.delFlag = delFlag;
            }

    public Integer getDelFlag()
            {
            return delFlag;
            }

@Override
public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("title", getTitle())
            .append("name", getName())
            .append("fileId", getFileId())
            .append("type", getType())
            .append("isShow", getIsShow())
            .append("delFlag", getDelFlag())
            .append("createTime", getCreateTime())
            .append("createBy", getCreateBy())
            .append("updateTime", getUpdateTime())
            .append("updateBy", getUpdateBy())
        .toString();
        }
        }
